﻿Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports DevComponents.DotNetBar
Imports System.Net
Imports System.Text.RegularExpressions
Imports System.Globalization



Public Class FrmProveedores


    Dim variableconex As New SqlConnection(My.Settings.CITRA_ERPConnectionString)


    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick

        'If ModGeneral.EstadoRed() = False Then
        'Status.Visible = True
        'Else
        'Status.Visible = False
        'End If

    End Sub


    Private Sub FamiliasBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs)

        Me.Validate()
        Me.FamiliasBindingSource.EndEdit()

    End Sub

    Private Sub ButtonX1_Click(sender As Object, e As EventArgs) Handles ButtonX1.Click
        Me.Close()
    End Sub


    Private Sub ButtonX10_Click(sender As Object, e As EventArgs) Handles btnEMas1.Click
        btnEMas1.Visible = False
        btnEMenos2.Visible = True
        txtE2.Visible = True
        btnEMas2.Visible = True
    End Sub


    Private Sub btnEMenos2_Click(sender As Object, e As EventArgs) Handles btnEMenos2.Click

        btnEMas1.Visible = True
        btnEMenos2.Visible = False
        txtE2.Visible = False
        txtE2.Text = ""
        btnEMas2.Visible = False


    End Sub

    Private Sub btnEMas2_Click(sender As Object, e As EventArgs) Handles btnEMas2.Click

        btnEMas2.Visible = False
        btnEMenos2.Visible = False

        btnEMenos3.Visible = True
        txtE3.Visible = True


    End Sub

    Private Sub btnEMenos3_Click(sender As Object, e As EventArgs) Handles btnEMenos3.Click

        btnEMenos2.Visible = True
        btnEMas2.Visible = True

        btnEMenos3.Visible = False
        txtE3.Visible = False
        txtE3.Text = ""

    End Sub

    Private Sub ButtonX3_Click(sender As Object, e As EventArgs) Handles ButtonX3.Click
        PageSlider1.SelectedPage = PageSliderPage1
        BorrarCajas()
    End Sub




    Private Sub FrmProveedores_Load(sender As Object, e As EventArgs) Handles MyBase.Load

        CargarDatos()
        BorrarCajas()
        slideAccionesProveedor.IsOpen = False
        slideNuevoProveedores.IsOpen = False
        slideOpcionesProveedor.IsOpen = False
        slideReportesProveedor.IsOpen = False
        slideOpcionesProveedor.BackColor = Color.Black


        Me.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtRazonSocial.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtRFC.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtCurp.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtbuscar.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtCredito.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtDenominacion.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtDescuento.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtDescuento2.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtE1.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtE2.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtE3.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtFTP.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtLimiteCredito.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor
        txtWeb.BackColor = StyleManager.MetroColorGeneratorParameters.CanvasColor


    End Sub




    Private Sub ButtonItem7_Click(sender As Object, e As EventArgs)

        insertarActualizar()


    End Sub


    Private Sub ButtonX2_Click(sender As Object, e As EventArgs) Handles ButtonX2.Click

        Modificar()

    End Sub

    Private Sub ButtonItem8_Click(sender As Object, e As EventArgs)
        OcultarEtiquetas()
        BorrarCajas()

    End Sub


    Public Sub CargarDatos()

        Dim DS As New DataSet
        Dim DA As New SqlDataAdapter("select p.IDPROVEEDOR, f1.Nombre as Familia1, p.idFamilia1 as Familia1,f2.Nombre as Familia2, p.idFamilia2 as Familia2, f3.Nombre as Familia3, p.idFamilia3 as Familia3, imp.Nombre as Impuesto_Retencion, p.idimp_ret as Impuesto_Retencion, p.RAZON_SOCIAL, p.RFC, p.CURP, P.DENOMINACION, p.DESCUENTO1, p.DESCUENTO2, p.ESCREDITO, p.EXCE_CREDITO, p.LIMITE_CREDITO, p.credito, p.MAIL1, p.MAIL2, p.MAIL3, p.WEB, p.FTP from Proveedores p left join Familias f1 on p.IDFAMILIA1=f1.IDFAMILIA left join Familias f2 on p.IDFAMILIA2=f2.IDFAMILIA left join Familias f3 on p.IDFAMILIA3=f3.IDFAMILIA left join Impuestos_Retenciones imp on p.IDIMP_RET=imp.IDIMP_RET  where STATUS='True';", variableconex)
        DA.Fill(DS)

        DataGridView5.DataSource = DS.Tables(0)

        DataGridView5.Columns(0).Visible = False
        DataGridView5.Columns(2).Visible = False
        DataGridView5.Columns(4).Visible = False
        DataGridView5.Columns(6).Visible = False
        DataGridView5.Columns(8).Visible = False

        llenarComboFamilia1()
        llenarComboFamilia2()
        llenarComboFamilia3()
        llenarComboRetencion()

    End Sub

    Public Sub llenarComboFamilia1()

        Dim ds As New DataSet
        Dim da As New SqlDataAdapter("select idFamilia, NOMBRE from familias;", variableconex)
        da.Fill(ds)

        cmbFamilia1.DataSource = ds.Tables(0)
        cmbFamilia1.DisplayMember = "NOMBRE"
        cmbFamilia1.ValueMember = "idFamilia"

    End Sub

    Public Sub llenarComboFamilia2()

        Dim ds As New DataSet
        Dim da As New SqlDataAdapter("select idFamilia, NOMBRE from familias;", variableconex)
        da.Fill(ds)

        cmbFamilia2.DataSource = ds.Tables(0)
        cmbFamilia2.DisplayMember = "NOMBRE"
        cmbFamilia2.ValueMember = "idFamilia"

    End Sub

    Public Sub llenarComboFamilia3()

        Dim ds As New DataSet
        Dim da As New SqlDataAdapter("select idFamilia, NOMBRE from familias;", variableconex)
        da.Fill(ds)

        cmbFamilia3.DataSource = ds.Tables(0)
        cmbFamilia3.DisplayMember = "NOMBRE"
        cmbFamilia3.ValueMember = "idFamilia"

    End Sub

    Public Sub llenarComboRetencion()

        Dim ds As New DataSet
        Dim da As New SqlDataAdapter("select IDIMP_RET, NOMBRE from Impuestos_Retenciones", variableconex)
        da.Fill(ds)

        cmbRetencion.DataSource = ds.Tables(0)
        cmbRetencion.DisplayMember = "NOMBRE"
        cmbRetencion.ValueMember = "IDIMP_RET"

    End Sub


    Public Sub insertarActualizar()

        Dim ESTATUSPROVEDOR As Integer = 1

        Dim EsCredito As Integer

        Dim ExcedeCredito As Integer

        If SwitchButton1.Value = True Then
            EsCredito = 1
        Else
            EsCredito = 0
        End If

        If SwitchButton2.Value = True Then
            ExcedeCredito = 1
        Else
            ExcedeCredito = 0
        End If

        Dim status As String
        status = "si"

        If (txtRazonSocial.Text.ToString.Equals("")) Then
            status = "no"

        End If

        If (txtRFC.Text.ToString.Equals("")) Then
            status = "no"
        End If

        If (txtDenominacion.Text.ToString.Equals("")) Then
            status = "no"
        End If

        If (txtDescuento.Text.ToString.Equals("")) Then
            status = "no"
        End If

        If (txtLimiteCredito.Text.ToString.Equals("")) Then
            status = "no"
        End If

        If (txtCredito.Text.ToString.Equals("")) Then
            status = "no"
        End If

      
        If (txtE1.Text.ToString.Equals("")) Then
            status = "no"
        End If


        If (status.Equals("si")) Then

            Dim Query3 As New DataSet_Prod_ServTableAdapters.ProveedoresTableAdapter


            If (lblProveedorModificar.Text = "") Then

                Query3.Insert(cmbFamilia1.SelectedValue.ToString, cmbFamilia2.SelectedValue.ToString, cmbFamilia3.SelectedValue.ToString, cmbRetencion.SelectedValue.ToString, txtRazonSocial.Text.ToString, txtRFC.Text.ToString, txtCurp.Text.ToString, txtDenominacion.Text.ToString, txtDescuento.Text.ToString, txtDescuento2.Text.ToString, EsCredito.ToString, ExcedeCredito.ToString, txtLimiteCredito.Text.ToString, txtCredito.Text.ToString, txtE1.Text.ToString, txtE2.Text.ToString, txtE3.Text.ToString, txtWeb.Text.ToString, txtFTP.Text.ToString, ESTATUSPROVEDOR.ToString)

                CargarDatos()

                PageSlider1.SelectedPage = PageSliderPage2

                BorrarCajas()

                ToastNotification.Show(Me, "Proveedor agregado correctamente", My.Resources.checkHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

            Else

                Dim DS As New DataSet
                Dim DA As New SqlDataAdapter("UPDATE Proveedores SET " & _
                                             "IDFAMILIA1 = " & cmbFamilia1.SelectedValue.ToString & "," & _
                                             "IDFAMILIA2 = " & cmbFamilia2.SelectedValue.ToString & "," & _
                                             "IDFAMILIA3 = " & cmbFamilia3.SelectedValue.ToString & "," & _
                                             "IDIMP_RET = " & cmbRetencion.SelectedValue.ToString & "," & _
                                             "RAZON_SOCIAL = '" & txtRazonSocial.Text.ToString & "'," & _
                                             "RFC = '" & txtRFC.Text.ToString & "'," & _
                                             "CURP = '" & txtCurp.Text.ToString & "'," & _
                                             "DENOMINACION = '" & txtDenominacion.Text.ToString & "'," & _
                                             "DESCUENTO1 = '" & txtDescuento.Text.ToString & "'," & _
                                             "DESCUENTO2 = '" & txtDescuento2.Text.ToString & "'," & _
                                             "ESCREDITO = " & EsCredito.ToString & "," & _
                                             "EXCE_CREDITO = " & ExcedeCredito.ToString & "," & _
                                             "LIMITE_CREDITO = " & txtLimiteCredito.Text.ToString & "," & _
                                             "CREDITO = " & txtCredito.Text.ToString & "," & _
                                             "MAIL1 = '" & txtE1.Text.ToString & "'," & _
                                             "MAIL2 = '" & txtE2.Text.ToString & "'," & _
                                             "MAIL3 = '" & txtE3.Text.ToString & "'," & _
                                             "WEB = '" & txtWeb.Text.ToString & "'," & _
                                             "FTP = '" & txtFTP.Text.ToString & "'," & _
                                             "STATUS = '" & ESTATUSPROVEDOR.ToString & "'" & _
                                             "WHERE IDPROVEEDOR = " & lblProveedorModificar.Text & "", variableconex)
                DA.Fill(DS)
                PageSlider1.SelectedPage = PageSliderPage2
                CargarDatos()
                BorrarCajas()
                OcultarEtiquetas()
                ToastNotification.Show(Me, "Modificado correctamente", My.Resources.checkHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

            End If

        Else

            ToastNotification.Show(Me, "No podemos avanzar Completa todos los campos solicitados", My.Resources.cancelHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

        End If

    End Sub


    Public Sub BorrarCajas()

        txtRazonSocial.Text = ""
        txtRFC.Text = ""
        txtCurp.Text = ""
        txtDenominacion.Text = ""
        txtDescuento.Text = ""
        txtDescuento2.Text = ""
        SwitchButton1.Value = False
        SwitchButton2.Value = False
        txtLimiteCredito.Text = ""
        txtCredito.Text = ""
        txtE1.Text = ""
        txtE2.Text = ""
        txtE3.Text = ""
        txtWeb.Text = ""
        txtFTP.Text = ""
        lblProveedorModificar.Text = ""

        cmbFamilia1.SelectedValue = 1
        cmbFamilia2.SelectedValue = 1
        cmbFamilia3.SelectedValue = 1
        cmbRetencion.SelectedValue = 1

    End Sub

    Public Sub Modificar()

        BorrarCajas()

        Try

            Dim fila As Integer
            fila = DataGridView5.CurrentCell.RowIndex
            Dim valor As String
            valor = DataGridView5.Rows(fila).Cells(0).Value.ToString()

            lblProveedorModificar.Text = DataGridView5.Rows(fila).Cells(0).Value.ToString()

            cmbFamilia1.SelectedValue = DataGridView5.Rows(fila).Cells(2).Value.ToString()
            cmbFamilia2.SelectedValue = DataGridView5.Rows(fila).Cells(4).Value.ToString()
            cmbFamilia3.SelectedValue = DataGridView5.Rows(fila).Cells(6).Value.ToString()
            cmbRetencion.SelectedValue = DataGridView5.Rows(fila).Cells(8).Value.ToString()


            txtRazonSocial.Text = DataGridView5.Rows(fila).Cells(9).Value.ToString()
            txtRFC.Text = DataGridView5.Rows(fila).Cells(10).Value.ToString()
            txtCurp.Text = DataGridView5.Rows(fila).Cells(11).Value.ToString()
            txtDenominacion.Text = DataGridView5.Rows(fila).Cells(12).Value.ToString()
            txtDescuento.Text = DataGridView5.Rows(fila).Cells(13).Value.ToString()
            txtDescuento2.Text = DataGridView5.Rows(fila).Cells(14).Value.ToString()


            If (DataGridView5.Rows(fila).Cells(15).Value.ToString() = "True") Then

                SwitchButton1.Value = True
            Else
                SwitchButton1.Value = False
            End If

            If (DataGridView5.Rows(fila).Cells(16).Value.ToString() = "True") Then

                SwitchButton2.Value = True
            Else
                SwitchButton2.Value = False
            End If

            txtLimiteCredito.Text = DataGridView5.Rows(fila).Cells(17).Value.ToString()
            txtCredito.Text = DataGridView5.Rows(fila).Cells(18).Value.ToString()
            txtE1.Text = DataGridView5.Rows(fila).Cells(19).Value.ToString()
            txtE2.Text = DataGridView5.Rows(fila).Cells(20).Value.ToString()
            txtE3.Text = DataGridView5.Rows(fila).Cells(21).Value.ToString()
            txtWeb.Text = DataGridView5.Rows(fila).Cells(22).Value.ToString()
            txtFTP.Text = DataGridView5.Rows(fila).Cells(23).Value.ToString()

            PageSlider1.SelectedPage = PageSliderPage1

            txtE2.Visible = True
            txtE3.Visible = True
            btnEMas1.Visible = False
            btnEMenos3.Visible = True

            MostrarEtiquetas()

        Catch ex As Exception

            ToastNotification.Show(Me, "No has seleccionado valor para editar", My.Resources.cancelHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

        End Try
        

    End Sub




    Public Sub Buscar()

        Dim DS As New DataSet
        Dim DA As New SqlDataAdapter("select p.IDPROVEEDOR, f1.Nombre as Familia1, p.idFamilia1 as Familia1,f2.Nombre as Familia2, p.idFamilia2 as Familia2, f3.Nombre as Familia3, p.idFamilia3 as Familia3, imp.Nombre as Impuesto_Retencion, p.idimp_ret as Impuesto_Retencion, p.RAZON_SOCIAL, p.RFC, p.CURP, P.DENOMINACION, p.DESCUENTO1, p.DESCUENTO2, p.ESCREDITO, p.EXCE_CREDITO, p.LIMITE_CREDITO, p.credito, p.MAIL1, p.MAIL2, p.MAIL3, p.WEB, p.FTP from Proveedores p left join Familias f1 on p.IDFAMILIA1=f1.IDFAMILIA left join Familias f2 on p.IDFAMILIA2=f2.IDFAMILIA left join Familias f3 on p.IDFAMILIA3=f3.IDFAMILIA left join Impuestos_Retenciones imp on p.IDIMP_RET=imp.IDIMP_RET where RAZON_SOCIAL LIKE '%" & txtbuscar.Text.ToString & "%' and Status='True'", variableconex)
        DA.Fill(DS)

        DataGridView5.DataSource = DS.Tables(0)

        DataGridView5.Columns(0).Visible = False
        DataGridView5.Columns(2).Visible = False
        DataGridView5.Columns(4).Visible = False
        DataGridView5.Columns(6).Visible = False
        DataGridView5.Columns(8).Visible = False


    End Sub



    Private Sub txtbuscar_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtbuscar.KeyPress

        Buscar()
        btncancelarbusqueda.Visible = True

    End Sub

    Private Sub btncancelarbusqueda_Click(sender As Object, e As EventArgs) Handles btncancelarbusqueda.Click

        CargarDatos()
        btncancelarbusqueda.Visible = False
        txtbuscar.Text = ""

    End Sub


    Private Sub ButtonItem21_Click(sender As Object, e As EventArgs)
        Close()
    End Sub


    Private Sub ButtonItem10_Click(sender As Object, e As EventArgs)
        MsgBox(cmbFamilia1.SelectedValue.ToString)
    End Sub

    Private Sub txtLimiteCredito_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtLimiteCredito.KeyPress

        lblLimiteCredito.Visible = True

        If (Char.IsNumber(e.KeyChar)) Or (e.KeyChar = ChrW(Keys.Back)) Or (e.KeyChar = ".") And (txtLimiteCredito.Text.Contains(".") = False) Then
            e.Handled = False
        Else
            e.Handled = True
        End If

    End Sub

    Private Sub txtCredito_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCredito.KeyPress

        lblCredito.Visible = True

        If (Char.IsNumber(e.KeyChar)) Or (e.KeyChar = ChrW(Keys.Back)) Or (e.KeyChar = ".") And (txtCredito.Text.Contains(".") = False) Then
            e.Handled = False
        Else
            e.Handled = True
        End If

    End Sub

    Private Sub txtRazonSocial_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRazonSocial.KeyPress
        lblRazonSocial.Visible = True
    End Sub


    Public Sub MostrarEtiquetas()

        lblRazonSocial.Visible = True
        lblRFC.Visible = True
        lblCurp.Visible = True
        lblDenominacion.Visible = True
        lblDescuento.Visible = True
        lblDescuento2.Visible = True
        lblLimiteCredito.Visible = True
        lblCredito.Visible = True
        lblDireccionWeb.Visible = True
        lblFTP.Visible = True
        
    End Sub

    Public Sub OcultarEtiquetas()

        lblRazonSocial.Visible = False
        lblRFC.Visible = False
        lblCurp.Visible = False
        lblDenominacion.Visible = False
        lblDescuento.Visible = False
        lblDescuento2.Visible = False
        lblLimiteCredito.Visible = False
        lblCredito.Visible = False
        lblDireccionWeb.Visible = False
        lblFTP.Visible = False

    End Sub

    Private Sub txtRFC_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtRFC.KeyPress
        lblRFC.Visible = True
    End Sub

    Private Sub txtCurp_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtCurp.KeyPress
        lblCurp.Visible = True
    End Sub

    Private Sub txtDenominacion_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDenominacion.KeyPress
        lblDenominacion.Visible = True
    End Sub

    Private Sub txtDescuento_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDescuento.KeyPress
        lblDescuento.Visible = True
    End Sub

    Private Sub txtDescuento2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtDescuento2.KeyPress
        lblDescuento2.Visible = True
    End Sub

    Private Sub txtWeb_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtWeb.KeyPress
        lblDireccionWeb.Visible = True
    End Sub

    Private Sub txtFTP_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtFTP.KeyPress
        lblFTP.Visible = True
    End Sub

    Private Sub ButtonItem22_Click(sender As Object, e As EventArgs) Handles ButtonItem22.Click
        insertarActualizar()
    End Sub

    Private Sub ButtonItem34_Click(sender As Object, e As EventArgs) Handles ButtonItem34.Click
        OcultarEtiquetas()
        BorrarCajas()
    End Sub

    Private Sub ButtonItem35_Click(sender As Object, e As EventArgs) Handles ButtonItem35.Click
        PageSlider1.SelectedPage = PageSliderPage2

    End Sub

    Private Sub ButtonItem1_Click(sender As Object, e As EventArgs) Handles ButtonItem1.Click
        slideOpcionesProveedor.IsOpen = False
    End Sub

    Private Sub ButtonItem20_Click(sender As Object, e As EventArgs) Handles ButtonItem20.Click
        slideReportesProveedor.IsOpen = True
    End Sub

    Private Sub ButtonItem24_Click(sender As Object, e As EventArgs) Handles ButtonItem24.Click
        slideReportesProveedor.IsOpen = False
    End Sub

    Private Sub ButtonItem23_Click(sender As Object, e As EventArgs) Handles ButtonItem23.Click
        slideAccionesProveedor.IsOpen = False
    End Sub

    Private Sub ButtonItem15_Click(sender As Object, e As EventArgs) Handles ButtonItem15.Click
        slideAccionesProveedor.IsOpen = True
    End Sub

    Private Sub btnCerrar_Click(sender As Object, e As EventArgs) Handles btnCerrar.Click
        slideNuevoProveedores.IsOpen = False
    End Sub

    Private Sub ButtonItem7_Click_1(sender As Object, e As EventArgs) Handles ButtonItem7.Click
        slideNuevoProveedores.IsOpen = True
    End Sub

    Private Sub btnMostrarOpciones_Click(sender As Object, e As EventArgs) Handles btnMostrarOpciones.Click
        slideOpcionesProveedor.IsOpen = True
    End Sub

    Private Sub txtRazonSocial_TextChanged(sender As Object, e As EventArgs) Handles txtRazonSocial.TextChanged

    End Sub

    Private Sub lblRFC_Click(sender As Object, e As EventArgs) Handles lblRFC.Click

    End Sub

    Private Sub ItemPanel10_ItemClick(sender As Object, e As EventArgs) Handles ItemPanel10.ItemClick

    End Sub

    Private Sub ButtonItem19_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub ButtonX4_Click(sender As Object, e As EventArgs) Handles ButtonX4.Click
        borrarProveedor()
    End Sub

    Public Sub borrarProveedor()

        Try

            Dim fila As Integer
            fila = DataGridView5.CurrentCell.RowIndex
            Dim valor As String
            Dim Razon As String
            valor = DataGridView5.Rows(fila).Cells(0).Value.ToString()

            Razon = DataGridView5.Rows(fila).Cells(9).Value.ToString()

            Dim estatus As Object = 0

            If MessageBoxEx.Show("¿Seguro que deseas eliminar el proveedor? " & Razon.ToString, "Eliminar Proveedor", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) = DialogResult.OK Then

                Dim DS As New DataSet
                Dim DA As New SqlDataAdapter("UPDATE Proveedores SET " & _
                                             "STATUS = '" & estatus.ToString & "'" & _
                                             "WHERE IDPROVEEDOR = " & valor.ToString & "", variableconex)
                DA.Fill(DS)

                CargarDatos()

                ToastNotification.Show(Me, "Eliminado correctamente", My.Resources.checkHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

            End If

        Catch ex As Exception

            ToastNotification.Show(Me, "No has seleccionado proveedor para eliminarlo", My.Resources.cancelHommer, 3000, eToastGlowColor.Blue, eToastPosition.MiddleCenter)

        End Try


    End Sub
End Class